package com.ruoyi.juhang.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.juhang.domain.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.juhang.mapper.ApplyMapper;
import com.ruoyi.juhang.domain.Apply;
import com.ruoyi.juhang.service.IApplyService;

/**
 * 报名记录Service业务层处理
 *
 * @author wanghong
 * @date 2025-03-16
 */
@Service
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements IApplyService
{
    @Autowired
    private ApplyMapper applyMapper;

    /**
     * 查询报名记录
     *
     * @param id 报名记录主键
     * @return 报名记录
     */
    @Override
    public Apply selectApplyById(Integer id)
    {
        return applyMapper.selectApplyById(id);
    }

    /**
     * 查询报名记录列表
     *
     * @param apply 报名记录
     * @return 报名记录
     */
    @Override
    public List<Apply> selectApplyList(Apply apply)
    {
        return applyMapper.selectApplyList(apply);
    }

    /**
     * 新增报名记录
     *
     * @param apply 报名记录
     * @return 结果
     */
    @Override
    public int insertApply(Apply apply)
    {
        apply.setCreateTime(DateUtils.getNowDate());
        return applyMapper.insertApply(apply);
    }

    /**
     * 修改报名记录
     *
     * @param apply 报名记录
     * @return 结果
     */
    @Override
    public int updateApply(Apply apply)
    {
        apply.setUpdateTime(DateUtils.getNowDate());
        return applyMapper.updateApply(apply);
    }

    /**
     * 批量删除报名记录
     *
     * @param ids 需要删除的报名记录主键
     * @return 结果
     */
    @Override
    public int deleteApplyByIds(Integer[] ids)
    {
        return applyMapper.deleteApplyByIds(ids);
    }

    /**
     * 删除报名记录信息
     *
     * @param id 报名记录主键
     * @return 结果
     */
    @Override
    public int deleteApplyById(Integer id)
    {
        return applyMapper.deleteApplyById(id);
    }

    @Override
    public IPage<Post> getApplyPostList(IPage<Post> page, QueryWrapper<Post> queryWrapper) {
        return applyMapper.getApplyPostList(page, queryWrapper);
    }
}
